<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 400px;
        height: 300px;
        margin: 0 auto;
        background-color: #eee;
      }
      .header {
        width: 100%;
        height: 100px;
        background-color: red;
      }
      .main {
        width: 100%;
        height: 100px;
        background-color: #eee;
      }
      @media screen and (min-width: 720px) and (max-width: 1028px) {
        .main {
          width: 100%;
          height: 100px;
          background-color: green;
        }
        .header {
          width: 100%;
          height: 100px;
          background-color: #eee;
        }
      }
      @media screen and (max-width: 720px) {
        .header {
          width: 100%;
          height: 100px;
          background-color: #eee;
        }
        .main {
          width: 100%;
          height: 100px;
          background-color: #eee;
        }
        .footer {
          width: 100%;
          height: 100px;
          background-color: yellow;
        }
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="header">header</div>
      <div class="main">main</div>
      <div class="footer">footer</div>
    </div>
  </body>
</html>
